package Project.Zoo;

public class Dolphin extends Animal implements Terrestrial {
    public Dolphin(String name) {
        super(name);
    }

    @Override
    public void shout() {
        System.out.println("海豚音");
    }

    @Override
    public int getLegNum() {
        return 0;
    }

    @Override
    public void setLegNum(int legNum)throws Exception {
        if (legNum == 0) {
            super.setLegNum(legNum);
        }else{
            throw new Exception("海豚的腿数只能为0！");
        }
    }
}
